https://codeforces.com/blog/entry/81716
https://codeforces.com/blog/entry/83248 